# Contributor Ricky Wu <rickleaf.wu@hotmail.com>

_realname=gtkwave
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.3.79
pkgrel=1
pkgdesc='GTKWaveGTKWave is a fully featured GTK+ based wave viewer for Unix, Win32, and Mac OSX'
arch=('any')
url='https://gtkwave.sourceforge.io/'
license=('GPL')

depends=("${MINGW_PACKAGE_PREFIX}-gtk2" 
         "${MINGW_PACKAGE_PREFIX}-tk"
         "${MINGW_PACKAGE_PREFIX}-tklib"
         "${MINGW_PACKAGE_PREFIX}-tcl"
         "${MINGW_PACKAGE_PREFIX}-tcllib"
         "${MINGW_PACKAGE_PREFIX}-adwaita-icon-theme")

makedepends=('perlxml'
             'intltool'
             "${MINGW_PACKAGE_PREFIX}-gcc")

install=gtkwave-${CARCH}.install

optdepends=("${MINGW_PACKAGE_PREFIX}-python2"
            )
source=("https://gtkwave.sourceforge.io/${_realname}-${pkgver}.tar.gz"
        )

sha256sums=('796538e92fd33ee65f315c314e33efb71abd4fe90d7cb1dd5e60382474a79de2'
			)

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"

  ./autogen.sh
}

build() {
  mkdir -p "build-${MINGW_CHOST}"
  cd "build-${MINGW_CHOST}"

  ../${_realname}-${pkgver}/configure \
	--with-tcl=${MINGW_PREFIX}/lib/tclConfig.sh \
	--with-tk=${MINGW_PREFIX}/lib/tkConfig.sh \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX}
  make
}

package() {
  cd "build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
